using System;
using System.Xml;
using System.Xml.XPath; // Contains XPathNavigator 
using System.Data;
using System.Collections;

namespace Model
{
	/// <summary>
	/// Declares the methods that will be called by the clients.
	/// </summary>
	public interface IRemoteService
	{
		/// <summary>
		/// THis method should return the usernames of all users registered in the database
		/// </summary>
		/// <returns>ArrayList of Strings</returns>
		ArrayList GetUserNames();
		
		
		/// <summary>
		/// To validate user login 
		/// </summary>
		bool ValidateLogin(UserIdentity user);

		/// <summary>
		/// Add a new user to the System
		/// It also updates the DB
		/// </summary>
		void AddNewUser(UserIdentity user);

		/// <summary>
		/// If the user is logged in, the user's credentials are changed
		/// </summary>
		void ChangePassword(UserIdentity user);		

		/// <summary>
		/// Removes the user from the pool of logged on users
		/// </summary>
		void LogOut(UserIdentity user);

		/// <summary>
		/// Add new transaction into XML database
		/// </summary>
		uint AddNewTransaction(UserIdentity user, Transaction transaction,ExternalAccount account);

		/// <summary>
		/// Adds transactions to the DB in bulk.
		/// </summary>
		/// <param name="user"></param>
		/// <param name="transactions">list of transactions</param>
		// void AddNewTransactions(UserIdentity user,ArrayList transactions);


		/// <summary>
		/// Fetch all transactions in which a particular user is involved
		/// </summary>
		/// <param name="user"></param>
		/// <returns></returns>
		ArrayList GetAllUserTransactions(UserIdentity user);

		/// <summary>
		/// Fetch all transactions with a notification flag, in which a particular user is involved
		/// </summary>
		/// <param name="user"></param>
		/// <returns></returns>
		ArrayList GetTransactionsWithNotifications(UserIdentity user);

		/// <summary>
		/// Assumes no notification
		/// </summary>
		/// <param name="user"></param>
		/// <param name="tx"></param>
		void UpdateTransaction(UserIdentity user, Transaction tx,Transaction oldtx);

		
		void AddNewExternalAccount(UserIdentity user, ExternalAccount account);

		/// <summary>
		/// Fetch all external account information of a user
		/// </summary>
		/// <returns></returns>
		ArrayList GetAllUserExternalAccounts(UserIdentity user);

		/// <summary>
		/// Remove the notification for this user on this transaction id
		/// </summary>
		/// <param name="transactionID"></param>
		void TransactionNotificationApproved(UserIdentity user, uint transactionID);

		void DeleteTransaction(UserIdentity user,uint ID);
		
		/// <summary>
		/// whould will add a notification to the uses notification list
		/// </summary>
		/// <param name="user"></param>
		/// <param name="TransactionID"></param>
		/// <param name="UserName"></param>
		void NotifyUserOnTransaction(UserIdentity user,String userName, uint TransactionID);
		
		/// <summary>
		/// will notify list of users of a trasaction
		/// </summary>
		/// <param name="user"></param>
		/// <param name="TransactionID"></param>
		/// <param name="usersToNotify"></param>
		void NotifyUsersOnTransaction(UserIdentity user, uint transactionID, string[] usersToNotify);	


		void UpdateExternalAccount(UserIdentity user, ExternalAccount oldAcc,ExternalAccount newAcc);

		/// <summary>
		/// get the transaction id's of all transactions where the user is involved.
		/// </summary>
		/// <param name="user"></param>
		/// <returns>ArrayList of strings which are transaction id's</returns>
		ArrayList GetNotifications(UserIdentity user);

		/// <summary>
		/// Get the time at which the user was last logged in
		/// </summary>
		/// <param name="user"></param>
		/// <returns></returns>
		DateTime UserLastLoggedIn(UserIdentity user);

	}
	

}
